package edu.isquen.core.role.service;

import edu.isquen.core.base.dao.IBaseDAO;
import edu.isquen.core.base.service.BaseServiceImpl;
import edu.isquen.core.role.model.Role;
import edu.isquen.util.CommUtil;
import edu.isquen.util.factory.DaoFactory;

public class RoleServiceImpl extends BaseServiceImpl implements RoleService {
	
	private static final long serialVersionUID = -7779346906573870955L;

	@Override
	public IBaseDAO<?> getDao() throws Exception {
		return DaoFactory.getDao(Role.class.getName());
	}

	public Role doSaveOrUpdate(Role role) throws Exception {
		if (role == null) {
			return null;
		}
		if (!CommUtil.validateString(role.getId())) {
				this.doCreate(role);
		} else {
			this.doUpdate(role);
		}
		return role;
	}
	
	

}
